import { MysqlClient } from "./MySqlClient";
import fs = require("fs")
import path = require("path")
import { Logger } from "./Logger";
// import { DbConfig } from "../../config/DbConfig";

export class MysqlManager {

    // 导出结构不导出数据
    //  /usr/local/mysql/bin/mysqldump --opt -d test -u root -p > ~/test.sql 

    // 导出数据不导出结构
    // mysqldump　-t　数据库名　-uroot　-p　>　xxx.sql

    // 导出数据和表结构
    // mysqldump　数据库名　-uroot　-p　>　xxx.sql

    // 导出特定表的结构
    // mysqldump　-uroot　-p　-B　数据库名　--table　表名　>　xxx.sql

    public static instance: MysqlManager = new MysqlManager();

    public dbMap: Map<string, MysqlClient> = new Map<string, MysqlClient>();

    // public async createClient(dbName: string) {
    //     let dbConfig: DbConfig = DbConfig.getDbConfig(DbConfig.now_db_type)
    //     let client: MysqlClient = await MysqlClient.create(dbName, dbConfig.host, dbConfig.port, dbConfig.user, dbConfig.pass);
    //     this.dbMap.set(dbName, client);
    //     return client;
    // }

    // public async getDb(dbName: string) {
    //     let db: MysqlClient;
    //     if (this.dbMap.has(dbName)) {
    //         db = this.dbMap.get(dbName);
    //     } else {
    //         let dbType: number = DbConfig.now_db_type;
    //         Logger.info("数据库client", dbName, dbType);
    //         db = await this.createClient(dbName);
    //     }
    //     return db;
    // }
}